﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OnlineMusic
{
    public partial class SetForm : Form
    {
        mainf mainf;

        public SetForm(mainf main)
        {
            InitializeComponent();
            this.mainf = main;
        }

        public void SetStatus(bool enable, int h, int m, int s, bool shutdown)
        {
            cenable.Checked = enable;
            nh.Value = h;
            nm.Value = m;
            ns.Value = s;
            if (shutdown)
                rsd.Checked = true;
            else
                rnone.Checked = true;
        }

        private void OK_Click(object sender, EventArgs e)
        {
            bool enable = cenable.Checked, shutdown = false;
            int h = 0, m = 0, s = 0;
            if (enable)
            {
                h = (int)nh.Value;
                m = (int)nm.Value;
                s = (int)ns.Value;
                shutdown = rsd.Checked;
            }
            mainf.SetTimeTask(enable, h, m, s, shutdown);
        }

        private void cenable_CheckedChanged(object sender, EventArgs e)
        {
            setp.Enabled = cenable.Checked;
        }
    }
}
